mui = LibStub("AceAddon-3.0"):NewAddon("mui")

BNSetMatureLanguageFilter(false)
	
--MINIMAP
Minimap:SetMaskTexture('Interface\\ChatFrame\\ChatFrameBackground') --square
Minimap:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -10, -10) --scoots it into corner
--hide fug borders & unnecessary buttons
MinimapBorder:Hide()
MinimapBorderTop:Hide()
MiniMapVoiceChatFrame:Hide()
MiniMapWorldMapButton:Hide()
MinimapNorthTag:SetTexture(nil)
MiniMapTrackingButtonBorder:Hide()
MinimapZoneTextButton:Hide()
--scroll instead of zoom buttons
Minimap:EnableMouseWheel(true)
Minimap:SetScript("OnMouseWheel", function(self, d)
	if d > 0 then
		_G.MinimapZoomIn:Click()
	elseif d < 0 then
		_G.MinimapZoomOut:Click()
	end
end)
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
--move calendar
GameTimeFrame:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT", 10, 5)
--move tracker & make transparent
MiniMapTracking:ClearAllPoints()
MiniMapTracking:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", 2, -2)
MiniMapTrackingBackground:SetTexture(nil)
--move mail icon
MiniMapMailFrame:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT", 8, -32)
--move difficulty flags to corner
MiniMapInstanceDifficulty:ClearAllPoints()
MiniMapInstanceDifficulty:SetParent(Minimap)
MiniMapInstanceDifficulty:SetPoint("TOPLEFT", Minimap, "TOPLEFT", 0, 0)
GuildInstanceDifficulty:ClearAllPoints()
GuildInstanceDifficulty:SetParent(Minimap)
GuildInstanceDifficulty:SetPoint("TOPLEFT", Minimap, "TOPLEFT", 0, 0)

--CHAT FRAME
for i = 1, NUM_CHAT_WINDOWS do
	local frame = _G["ChatFrame"..i]
	local editbox = _G["ChatFrame"..i.."EditBox"]
	frame:SetClampedToScreen(false) --can move it to bottom (and scoot left if you want to hide all those buttons)
	editbox:SetPoint("TOPLEFT", GeneralDockManager, "TOPLEFT") --editbox moved to top
end

function mui:OnInitialize()
	--FONTS

	
	local FontStandard = "Interface\\Addons\\mui\\ABF.ttf"
	local FontFancy = FontStandard

	STANDARD_TEXT_FONT = FontStandard
	UNIT_NAME_FONT     = FontStandard
	DAMAGE_TEXT_FONT   = FontStandard
	NAMEPLATE_FONT     = FontStandard

	local SizeSmall = 12
	local SizeMedium = 14
	local SizeLarge = 16
	local SizeHuge = 18
	local SizeInsane = 24

	SystemFont_Tiny:SetFont(                   FontStandard   , SizeSmall , nil)
	SystemFont_Small:SetFont(                  FontStandard   , SizeSmall , nil)
	SystemFont_Outline_Small:SetFont(          FontStandard   , SizeSmall , "OUTLINE")
	SystemFont_Shadow_Small:SetFont(           FontStandard   , SizeSmall , nil)
	SystemFont_InverseShadow_Small:SetFont(    FontStandard   , SizeSmall , nil)
	SystemFont_Med1:SetFont(                   FontStandard, SizeMedium, nil)
	SystemFont_Shadow_Med1:SetFont(            FontStandard, SizeMedium, nil)
	SystemFont_Med2:SetFont(                   FontStandard, SizeMedium, nil)
	SystemFont_Med3:SetFont(                   FontStandard, SizeMedium, nil)
	SystemFont_Shadow_Med3:SetFont(            FontStandard, SizeMedium, nil)
	SystemFont_Large:SetFont(                  FontStandard, SizeLarge , nil)
	SystemFont_Shadow_Large:SetFont(           FontStandard, SizeLarge , nil)
	SystemFont_Shadow_Huge1:SetFont(           FontStandard, SizeHuge  , nil)
	SystemFont_OutlineThick_Huge2:SetFont(     FontStandard, SizeHuge  , "THICKOUTLINE")
	SystemFont_Shadow_Outline_Huge2:SetFont(   FontStandard, SizeHuge  , "THICKOUTLINE")
	SystemFont_Shadow_Huge3:SetFont(           FontStandard, SizeHuge  , nil)
	SystemFont_OutlineThick_Huge4:SetFont(     FontStandard, SizeHuge  , "THICKOUTLINE")
	SystemFont_OutlineThick_WTF:SetFont(       FontStandard, SizeInsane, "THICKOUTLINE")
	NumberFont_Shadow_Small:SetFont(           FontStandard   , SizeSmall , nil)
	NumberFont_OutlineThick_Mono_Small:SetFont(FontStandard, SizeMedium, "OUTLINE")
	NumberFont_Shadow_Med:SetFont(             FontStandard, SizeMedium, nil)
	NumberFont_Outline_Med:SetFont(            FontStandard, SizeMedium, "OUTLINE")
	NumberFont_Outline_Large:SetFont(          FontStandard, SizeLarge , "OUTLINE")
	NumberFont_Outline_Huge:SetFont(           FontStandard, SizeHuge  , "OUTLINE")
	QuestFont_Large:SetFont(                   FontFancy   , SizeMedium, nil)
	QuestFont_Shadow_Huge:SetFont(             FontFancy   , SizeHuge  , nil)
	GameTooltipHeader:SetFont(                 FontStandard, SizeMedium, nil)
	MailFont_Large:SetFont(                    FontFancy   , SizeMedium, nil)
	SpellFont_Small:SetFont(                   FontStandard   , SizeSmall , nil)
	InvoiceFont_Med:SetFont(                   FontStandard, SizeMedium, nil)
	InvoiceFont_Small:SetFont(                 FontStandard   , SizeSmall , nil)
	Tooltip_Med:SetFont(                       FontStandard, SizeMedium, nil)
	Tooltip_Small:SetFont(                     FontStandard   , SizeSmall , nil)
	AchievementFont_Small:SetFont(             FontStandard   , SizeSmall , nil)
	ReputationDetailFont:SetFont(              FontStandard   , SizeSmall , nil)
	FriendsFont_UserText:SetFont(              FontStandard   , SizeSmall , nil)
	FriendsFont_Normal:SetFont(FontStandard, SizeMedium, nil)
	FriendsFont_Small:SetFont(FontStandard   , SizeSmall , nil)
	FriendsFont_Large:SetFont(FontStandard, SizeLarge , nil)
end

function mui:OnEnable()
	--minimap clock
	for i=1, TimeManagerClockButton:GetNumRegions() do
		local region = select(i, TimeManagerClockButton:GetRegions())
		if region:GetObjectType() == "Texture" then
			region:SetTexture(nil)
		end
	end
	TimeManagerClockButton:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, -5)
end